/*   1:    */package com.linkage.bss.commons.exception;
/*   2:    */
/*   3:    */import com.linkage.bss.commons.util.ExceptionUtil;
/*   4:    */import java.io.PrintStream;
/*   5:    */import java.io.PrintWriter;
/*   6:    */
/*  20:    */public class BssRuntimeException
/*  21:    */  extends RuntimeException
/*  22:    */{
/*  23:    */  private static final long serialVersionUID = -7636252675570711205L;
/*  24:    */  private Result result;
/*  25:    */  
/*  26:    */  public BssRuntimeException(Result result, Throwable cause)
/*  27:    */  {
/*  28: 28 */    super(result.getMsg(), cause);
/*  29: 29 */    this.result = result;
/*  30:    */  }
/*  31:    */  
/*  36:    */  public BssRuntimeException(int code, String msg)
/*  37:    */  {
/*  38: 38 */    super(msg);
/*  39: 39 */    this.result = new Result(code, msg);
/*  40:    */  }
/*  41:    */  
/*  46:    */  public BssRuntimeException(Result result, String detail)
/*  47:    */  {
/*  48: 48 */    super(result.getMsg() + "," + detail);
/*  49: 49 */    this.result = new Result(result.getCode(), result.getMsg() + "," + detail);
/*  50:    */  }
/*  51:    */  
/*  57:    */  public BssRuntimeException(Result result, String detail, Throwable cause)
/*  58:    */  {
/*  59: 59 */    super(result.getMsg() + "," + detail, cause);
/*  60: 60 */    this.result = new Result(result.getCode(), result.getMsg() + "," + detail);
/*  61:    */  }
/*  62:    */  
/*  68:    */  public BssRuntimeException(int code, String msg, Throwable cause)
/*  69:    */  {
/*  70: 70 */    super(msg, cause);
/*  71: 71 */    this.result = new Result(code, msg);
/*  72:    */  }
/*  73:    */  
/*  78:    */  public BssRuntimeException(int code, Throwable cause)
/*  79:    */  {
/*  80: 80 */    super(cause);
/*  81: 81 */    this.result = new Result(code, null);
/*  82:    */  }
/*  83:    */  
/*  88:    */  public String getMessage()
/*  89:    */  {
/*  90: 90 */    return ExceptionUtil.buildMessage(super.getMessage(), getCause());
/*  91:    */  }
/*  92:    */  
/*  95:    */  public String toXmlString()
/*  96:    */  {
/*  97: 97 */    StringBuilder sb = new StringBuilder();
/*  98: 98 */    sb.append("<exception>");
/*  99:    */    
/* 100:100 */    if (getResult() != null) {
/* 101:101 */      sb.append(this.result.toString());
/* 102:    */    }
/* 103:103 */    sb.append("<exceptionTrace>");
/* 104:104 */    sb.append(getMessage());
/* 105:105 */    sb.append("</exceptionTrace>");
/* 106:    */    
/* 107:107 */    sb.append("<exception/>");
/* 108:108 */    return sb.toString();
/* 109:    */  }
/* 110:    */  
/* 111:    */  public void printStackTrace(PrintStream ps)
/* 112:    */  {
/* 113:113 */    ps.print("<exception>");
/* 114:114 */    if (getResult() != null) {
/* 115:115 */      ps.print(this.result.toString());
/* 116:    */    }
/* 117:117 */    ps.append("<exceptionTrace>");
/* 118:    */    
/* 119:119 */    Throwable cause = getCause();
/* 120:120 */    if (cause == null) {
/* 121:121 */      super.printStackTrace(ps);
/* 122:    */    } else {
/* 123:123 */      ps.println(this);
/* 124:124 */      ps.print("Caused by: ");
/* 125:125 */      cause.printStackTrace(ps);
/* 126:    */    }
/* 127:127 */    ps.append("</exceptionTrace>");
/* 128:128 */    ps.println("</exception>");
/* 129:    */  }
/* 130:    */  
/* 131:    */  public void printStackTrace(PrintWriter pw)
/* 132:    */  {
/* 133:133 */    pw.print("<exception>");
/* 134:134 */    if (getResult() != null) {
/* 135:135 */      pw.print(this.result.toString());
/* 136:    */    }
/* 137:137 */    pw.append("<exceptionTrace>");
/* 138:    */    
/* 139:139 */    Throwable cause = getCause();
/* 140:140 */    if (cause == null) {
/* 141:141 */      super.printStackTrace(pw);
/* 142:    */    } else {
/* 143:143 */      pw.println(this);
/* 144:144 */      pw.print("Caused by: ");
/* 145:145 */      cause.printStackTrace(pw);
/* 146:    */    }
/* 147:147 */    pw.append("</exceptionTrace>");
/* 148:148 */    pw.println("</exception>");
/* 149:    */  }
/* 150:    */  
/* 154:    */  public Result getResult()
/* 155:    */  {
/* 156:156 */    return this.result;
/* 157:    */  }
/* 158:    */  
/* 159:    */  public void setResult(Result result) {
/* 160:160 */    this.result = result;
/* 161:    */  }
/* 162:    */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.exception.BssRuntimeException
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */